
<template>
  <div class="common-layout">
    <el-container>
      <el-aside width="200px">
        <Left></Left>
      </el-aside>
      <el-container>
        <el-header>Header
          <br/>{{ store_user.user }}
          <br/>
          <button v-on:click="btn">修改store</button>
        </el-header>
        <el-main>
          <router-view />
          <div id="subapp-container"></div>
        </el-main>
        <el-footer>Footer</el-footer>
      </el-container>
    </el-container>
  </div>
</template>

<script setup lang="ts">
import Left from './../components/Left.vue'
import actions from '@/action'
import { PROJECT_KEY } from '@/config'
import { useUserStore, type User } from '@glz/utils'
import { onMounted } from 'vue'

//const user = ref({} as User)

const store_user = useUserStore(PROJECT_KEY)


const btn = ()=>{

const userD : User = {
token :"base-vite-ts",
id: '12',
account:'header update',
mobile:'9999999',
avator: ''
}

store_user.setUser(userD)

const globalState = {
        theme: "red",
        language: "en",
        useUserStore: userD
    };

    actions.setGlobalState(globalState)

}

</script>

<style scoped>
.common-layout{
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}
  
  .el-container {
    height:100%;
  }

  .el-header{
    height: 140px;
  }
  .el-footer{
    background-color: #B3C001;
    color: #333;
    text-align: center;
    line-height: 60px;
  }

  .el-aside{
    background-color: #D3DCE6;
    color: #333;
    text-align: center;
    line-height: 200px;
  }

  .el-main{
    background-color: #E9EEF3;
    color: #333;
    text-align: center;
    line-height: 160px;
  }

</style>
